library(ggplot2)
library(maps) # 为了获取数据

## # ATTENTION: maps v3.0 has an updated ‘world’ map. #
## # Many country borders and names have changed since 1990. #
## # Type ‘?world’ or ‘news(package="maps")’. See README_v3. #

# 美国地图数据----

states_map <- map_data("state")

head(states_map)

# geom_polygon()

ggplot(states_map, aes(x = long, y = lat, group = group)) +
  geom_polygon(fill = "white", colour = "blue") +
  labs(title = "USA Map")

# China map ----
library(mapdata)
map("china", col = "red4", ylim = c(18,54), panel.first = grid())
title("China Map")

# 世界地图数据----
world_map <- map_data("world")
head(world_map)

#sort(unique(world_map$region))

# 绘制指定区域的地图数据
# 绘制欧洲足球五大联赛所在地

euro <- map_data("world", region = c("UK","France", "Spain","Germany", "Italy"))

ggplot(euro, aes(x = long, y = lat, group = group, fill = region)) +
  geom_polygon(colour = "black") +
  scale_fill_brewer(palette = "Set2") +
  scale_y_continuous(limits = c(40, 60)) +
  scale_x_continuous(limits = c(-25, 25)) +
  labs(title = " Euorpe’s Big Five Football Leagues")
